/* TEO — Agente IA Haleteo */

#teo.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 0px);
    max-height: 100%;
    padding: 0 !important;
    overflow: hidden;
}

.teo-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100%;
    min-height: 0;
    transition: grid-template-columns 0.22s ease;
}

.teo-layout--collapsed {
    grid-template-columns: 56px 1fr;
}

.teo-sidebar {
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    background: #f7f7f8;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.teo-sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 12px 10px 8px;
}

.teo-brand {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 4px 6px;
}

.teo-brand-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    opacity: 0.9;
}

.teo-brand-text {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #111;
}

.teo-icon-btn {
    border: none;
    background: transparent;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
}

.teo-icon-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.teo-icon-btn img {
    width: 18px;
    height: 18px;
    opacity: 0.75;
}

.teo-side-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 10px;
}

.teo-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 9px 10px;
    cursor: pointer;
    color: #222;
    font-size: 13.5px;
    text-align: left;
    position: relative;
}

.teo-nav-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.teo-nav-item.active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    font-weight: 600;
}

.teo-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.75;
}

.teo-nav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teo-nav-badge,
.teo-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #111;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.teo-side-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 4px;
}

.teo-side-section-title {
    padding: 12px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.teo-thread-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
}

.teo-thread-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px 4px 4px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #222;
    margin-bottom: 2px;
}

.teo-thread-item:hover,
.teo-thread-item.active {
    background: #ececec;
}

.teo-thread-open {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    padding: 6px 4px;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
}

.teo-thread-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teo-thread-pin-mark {
    font-size: 11px;
    flex-shrink: 0;
    opacity: 0.85;
}

.teo-thread-menu-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    font-size: 14px;
    line-height: 1;
    letter-spacing: 1px;
    opacity: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.teo-thread-item:hover .teo-thread-menu-btn,
.teo-thread-item.active .teo-thread-menu-btn {
    opacity: 1;
}

.teo-thread-menu-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.teo-thread-menu {
    position: absolute;
    top: calc(100% - 4px);
    right: 4px;
    z-index: 30;
    min-width: 200px;
    padding: 6px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.teo-thread-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 13px;
    color: #222;
    cursor: pointer;
    text-align: left;
}

.teo-thread-menu-item:hover {
    background: #f3f4f6;
}

.teo-thread-menu-item img {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.teo-thread-menu-item--danger {
    color: #dc2626;
}

.teo-thread-menu-item--danger img {
    filter: invert(27%) sepia(92%) saturate(2464%) hue-rotate(348deg) brightness(92%) contrast(92%);
    opacity: 1;
}

.teo-archived-toggle {
    display: block;
    width: calc(100% - 16px);
    margin: 4px 8px 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    text-align: left;
}

.teo-archived-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #111;
}

.teo-layout--collapsed .teo-archived-toggle {
    display: none;
}

/* Sidebar colapsado: solo iconos */
.teo-layout--collapsed .teo-brand-text,
.teo-layout--collapsed .teo-nav-label,
.teo-layout--collapsed .teo-side-section-title,
.teo-layout--collapsed .teo-thread-list,
.teo-layout--collapsed .teo-nav-badge,
.teo-layout--collapsed #teo-sidebar-toggle {
    display: none;
}

.teo-layout--collapsed .teo-sidebar-top {
    justify-content: center;
    padding: 12px 6px 6px;
}

.teo-layout--collapsed .teo-brand {
    padding: 6px;
}

.teo-layout--collapsed .teo-side-nav {
    align-items: center;
    padding: 4px 6px;
}

.teo-layout--collapsed .teo-nav-item {
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
}

.teo-layout--collapsed .teo-side-section {
    border-top: none;
}

.teo-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    position: relative;
}

.teo-main-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.teo-main-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.teo-open-sidebar {
    display: none;
}

.teo-layout--collapsed .teo-open-sidebar {
    display: inline-flex;
}

@media (max-width: 768px) {
    #teo.container {
        height: auto;
        max-height: none;
        padding: 0 0 calc(64px + env(safe-area-inset-bottom)) !important;
        overflow: hidden;
    }

    .teo-layout {
        grid-template-columns: 1fr;
        height: 100%;
    }

    .teo-sidebar {
        display: none;
    }

    .teo-layout:not(.teo-layout--collapsed) .teo-sidebar {
        display: flex;
        position: absolute;
        z-index: 20;
        inset: 0 auto 0 0;
        width: min(280px, 86vw);
        box-shadow: 8px 0 24px rgba(0, 0, 0, 0.12);
    }

    .teo-open-sidebar {
        display: inline-flex;
    }

    .teo-layout {
        position: relative;
    }

    .teo-input-wrap {
        padding: 12px 16px 16px;
    }
}

.teo-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.teo-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.teo-welcome h1 {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 28px;
    color: #111;
}

.teo-suggestions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 520px;
    margin-top: 20px;
}

.teo-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    border-radius: 14px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.15s, border-color 0.15s;
}

.teo-suggestion:hover {
    background: #f7f7f7;
    border-color: rgba(0, 0, 0, 0.14);
}

.teo-suggestion img {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.teo-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.teo-msg {
    max-width: 780px;
    width: 100%;
    margin: 0 auto;
}

.teo-msg-user .teo-bubble {
    background: #f4f4f4;
    border-radius: 18px;
    padding: 12px 16px;
    display: inline-block;
    max-width: 85%;
    float: right;
    clear: both;
    font-size: 14.5px;
    line-height: 1.45;
}

.teo-msg-assistant .teo-bubble {
    font-size: 14.5px;
    line-height: 1.55;
    color: #222;
}

/* Durante el stream en vivo (antes del markdown) respetar saltos de línea */
.teo-msg-assistant .teo-bubble.teo-bubble--streaming {
    white-space: pre-wrap;
}

.teo-msg-assistant .teo-bubble > *:first-child {
    margin-top: 0;
}

.teo-msg-assistant .teo-bubble > *:last-child {
    margin-bottom: 0;
}

.teo-msg-assistant .teo-bubble p {
    margin: 0 0 0.75em;
}

.teo-msg-assistant .teo-bubble ul,
.teo-msg-assistant .teo-bubble ol {
    margin: 0 0 0.75em;
    padding-left: 1.35em;
}

.teo-msg-assistant .teo-bubble li {
    margin: 0.2em 0;
}

.teo-msg-assistant .teo-bubble strong {
    font-weight: 650;
}

.teo-msg-assistant .teo-bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.teo-msg-assistant .teo-bubble pre {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    padding: 10px 12px;
    overflow-x: auto;
    margin: 0 0 0.75em;
}

.teo-msg-assistant .teo-bubble pre code {
    background: none;
    padding: 0;
}

.teo-msg::after {
    content: '';
    display: table;
    clear: both;
}

.teo-thinking {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6b6b6b;
    font-size: 13.5px;
    margin-bottom: 6px;
    user-select: none;
}

.teo-thinking-label {
    letter-spacing: 0.01em;
}

.teo-thinking-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.teo-thinking-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8a8a8a;
    animation: teo-thinking-bounce 1.2s infinite ease-in-out;
}

.teo-thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.teo-thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes teo-thinking-bounce {
    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

.teo-tool-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f4ff;
    color: #274690;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    margin: 4px 0;
}

.teo-tool-chip--live {
    animation: teo-chip-pulse 1.4s ease-in-out infinite;
}

@keyframes teo-chip-pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.65;
    }
}

.teo-confirm-card {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 16px 18px 14px;
    margin: 10px 0;
    background: #f5f5f7;
    max-width: 640px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: #1d1d1f;
}

.teo-confirm-card h4 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #1d1d1f;
}

.teo-confirm-card p,
.teo-confirm-text {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: #6e6e73;
}

.teo-confirm-kv {
    display: grid;
    gap: 4px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.teo-confirm-kv-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.teo-confirm-kv-label {
    color: #6e6e73;
}

.teo-confirm-kv-value {
    font-weight: 600;
    text-align: right;
    color: #1d1d1f;
}

.teo-confirm-table-title {
    font-size: 12px;
    font-weight: 600;
    color: #6e6e73;
    margin: 2px 0 8px;
    letter-spacing: 0.01em;
}

.teo-confirm-table-wrap {
    overflow-x: auto;
    margin: 0 0 8px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    background: #fff;
}

.teo-confirm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.teo-confirm-table th,
.teo-confirm-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    white-space: nowrap;
}

.teo-confirm-table th {
    background: #f5f5f7;
    font-weight: 600;
    color: #6e6e73;
}

.teo-confirm-table tr:last-child td {
    border-bottom: none;
}

.teo-confirm-table-footer {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    margin: 0 0 12px;
    color: #1d1d1f;
}

.teo-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.teo-confirm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.teo-confirm-btn--primary {
    background: #1d1d1f;
    color: #fff;
}

.teo-confirm-btn--primary:hover {
    background: #000;
    color: #fff;
}

.teo-confirm-btn--default {
    background: #fff;
    color: #1d1d1f;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.teo-confirm-btn--default:hover {
    background: #eeeef0;
}

.teo-confirm-btn--danger {
    background: transparent;
    color: #ff3b30;
}

.teo-confirm-btn--danger:hover {
    background: rgba(255, 59, 48, 0.08);
}

.teo-confirm-actions em {
    font-size: 13px;
    font-style: normal;
    color: #6e6e73;
}

.teo-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 8px 8px 0 0;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8fafc;
    text-decoration: none;
    color: inherit;
    max-width: 100%;
}

.teo-doc-chip:hover {
    background: #eef2ff;
    border-color: rgba(79, 70, 229, 0.35);
}

.teo-doc-chip-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.teo-doc-chip-name {
    font-size: 13px;
    font-weight: 600;
}

.teo-doc-chip-action {
    font-size: 11px;
    color: #666;
}

.teo-input-wrap {
    padding: 12px 24px 24px;
}

.teo-attach-chips {
    max-width: 780px;
    margin: 0 auto 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.teo-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 12px;
    color: #333;
}

.teo-attach-chip--busy {
    opacity: 0.7;
}

.teo-attach-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}

.teo-attach-chip-meta {
    color: #888;
}

.teo-attach-chip-remove {
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.teo-attach-btn {
    border: none;
    background: transparent;
    color: #555;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.teo-attach-btn:hover {
    background: #f3f4f6;
    color: #111;
}

.teo-chat-area.teo-drag-over {
    outline: 2px dashed #111;
    outline-offset: -8px;
    background: #fafafa;
}

.teo-msg-attaches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.teo-msg-attach {
    display: inline-block;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    padding: 4px 8px;
}

.teo-report-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(14, 165, 233, 0.35);
    background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
    color: #0c4a6e;
    text-decoration: none;
    max-width: 100%;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.teo-report-chip:hover {
    text-decoration: none;
    color: #075985;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.2);
    transform: translateY(-1px);
}

.teo-report-chip-icon {
    font-size: 22px;
    line-height: 1;
}

.teo-report-chip-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.teo-report-chip-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.teo-report-chip-action {
    font-size: 11px;
    color: #0284c7;
    font-weight: 500;
}

.teo-input-bar {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 28px;
    padding: 10px 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.teo-input-bar textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    font-family: inherit;
    max-height: 140px;
    min-height: 24px;
    line-height: 1.4;
    padding: 4px 0;
    background: transparent;
}

.teo-send-btn {
    border: none;
    background: #111;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.teo-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.teo-tasks-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.teo-tasks-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.teo-tasks-form {
    display: grid;
    grid-template-columns: 1fr minmax(180px, 220px) auto;
    gap: 8px;
    margin: 16px 0 20px;
}

.teo-tasks-form input {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.teo-tasks-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}

.teo-tasks-filter {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
}

.teo-tasks-filter.active {
    background: #111;
    border-color: #111;
    color: #fff;
}

.teo-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.teo-task-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fafafa;
}

.teo-task-item--overdue {
    border-color: rgba(180, 40, 40, 0.35);
    background: #fff8f8;
}

.teo-task-item--completado {
    opacity: 0.65;
}

.teo-task-title {
    font-size: 14px;
    font-weight: 600;
    color: #111;
}

.teo-task-desc {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

.teo-task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: #777;
}

.teo-task-estado {
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 11px;
}

.teo-task-prio {
    color: #b45309;
    font-weight: 600;
}

.teo-task-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    flex-shrink: 0;
}

.teo-task-actions button {
    border: none;
    background: transparent;
    color: #555;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.teo-task-when-edit {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 4px 6px;
    font-size: 12px;
    max-width: 190px;
}

@media (max-width: 700px) {
    .teo-tasks-form {
        grid-template-columns: 1fr;
    }
    .teo-task-item {
        flex-direction: column;
    }
    .teo-task-actions {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }
}

.teo-memory-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.teo-memory-panel h3 {
    margin: 0 0 8px;
    font-size: 18px;
}

.teo-memory-panel .teo-memory-desc {
    color: #666;
    font-size: 13px;
    margin-bottom: 20px;
}

.teo-memory-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.teo-memory-form input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

.teo-memory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.teo-memory-item {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fafafa;
}

.teo-memory-item .tipo {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    letter-spacing: 0.03em;
}

.teo-memory-item .content {
    font-size: 14px;
    margin: 6px 0;
}

.teo-memory-item .actions {
    display: flex;
    gap: 8px;
}

.teo-memory-item .actions button {
    border: none;
    background: transparent;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
}

.teo-briefing-box {
    max-width: 520px;
    width: 100%;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 8px;
    background: #f8fafc;
}

.teo-briefing-box h3 {
    margin: 0 0 10px;
    font-size: 15px;
}

.teo-briefing-box ul {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #333;
}

.teo-briefing-box li {
    margin-bottom: 6px;
}

.teo-empty {
    color: #888;
    font-size: 13px;
    padding: 20px;
    text-align: center;
}

@media (max-width: 800px) and (min-width: 769px) {
    .teo-layout {
        grid-template-columns: 1fr;
    }
    .teo-sidebar {
        display: none;
    }
    .teo-open-sidebar {
        display: inline-flex;
    }
}

/* --- TEO header widget --- */
.teo-header-wrap {
    position: relative;
}

.teo-header-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: #6b7280;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.teo-header-btn svg {
    display: block;
    width: 25px;
    height: 25px;
}

.teo-header-btn:hover,
.teo-header-btn[aria-expanded="true"] {
    background: #f3f4f6;
    color: #111827;
}

.teo-header-status {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid #fff;
    box-sizing: content-box;
    pointer-events: none;
}

.teo-header-status--working {
    background: #3b82f6;
    animation: teo-header-pulse 1s ease-in-out infinite;
}

.teo-header-status--done {
    background: #22c55e;
}

.teo-header-status--confirm {
    background: #1d1d1f;
    animation: teo-header-pulse 1.4s ease-in-out infinite;
}

.teo-header-status--error {
    background: #ef4444;
}

@keyframes teo-header-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.65; }
}

.teo-header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-width: min(320px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    z-index: 2000;
    overflow: hidden;
}

.teo-header-dropdown-header {
    padding: 12px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.teo-header-busy {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 16px;
    font-size: 13px;
    color: #4b5563;
}

.teo-header-busy-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #dbeafe;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: teo-header-spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes teo-header-spin {
    to { transform: rotate(360deg); }
}

.teo-header-composer {
    padding: 0 12px 12px;
}

.teo-header-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.teo-header-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 12px;
    color: #333;
}

.teo-header-chip--busy {
    opacity: 0.7;
}

.teo-header-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.teo-header-chip-meta {
    color: #888;
}

.teo-header-chip-remove {
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.teo-header-bar {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 6px 8px;
    background: #fff;
}

.teo-header-attach-btn,
.teo-header-send-btn {
    border: none;
    background: transparent;
    color: #555;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.teo-header-attach-btn:hover {
    background: #f3f4f6;
    color: #111;
}

.teo-header-send-btn {
    background: #111;
    color: #fff;
}

.teo-header-send-btn:hover {
    background: #1f2937;
}

.teo-header-attach-btn:disabled,
.teo-header-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.teo-header-bar textarea {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.4;
    padding: 6px 0;
    background: transparent;
    color: #111827;
}

@media (max-width: 768px) {
    .teo-header-dropdown {
        right: -8px;
        width: min(320px, calc(100vw - 24px));
    }
}

:root {
    --teo-chart-1: #2563eb;
    --teo-chart-2: #059669;
    --teo-chart-3: #d97706;
    --teo-chart-4: #db2777;
}

.teo-chart {
    width: 100%;
    max-width: 720px;
    margin: 10px 0;
}

.teo-chart-apex {
    width: 100%;
    min-width: 0;
    min-height: 280px;
}

.teo-chart-apex .apexcharts-canvas,
.teo-chart-svg {
    width: 100% !important;
    display: block;
}

.teo-chart-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

.teo-chart-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.teo-chart-table th,
.teo-chart-table td {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 4px 8px;
    text-align: left;
}

.teo-email-form {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
}

.teo-email-form label {
    display: grid;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: #6e6e73;
}

.teo-confirm-card .teo-field,
.teo-confirm-card .form-control {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: #fff;
    color: #1d1d1f;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.teo-confirm-card textarea.teo-field,
.teo-confirm-card textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.teo-confirm-card .teo-field::placeholder,
.teo-confirm-card .form-control::placeholder {
    color: #a1a1a6;
}

.teo-confirm-card .teo-field:focus,
.teo-confirm-card .form-control:focus {
    outline: none;
    border-color: #1d1d1f;
    box-shadow: 0 0 0 3px rgba(29, 29, 31, 0.12);
    background: #fff;
}

.teo-att-list {
    margin: 0 0 14px;
}

.teo-att-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    background: #fff;
    color: #1d1d1f;
}

.teo-att-row small {
    color: #6e6e73;
}

.teo-att-remove {
    border: none;
    background: transparent;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #8e8e93;
}

.teo-att-remove:hover {
    background: #f5f5f7;
    color: #1d1d1f;
}

.teo-confirm-warning {
    margin: 0 0 10px;
    font-size: 12px;
    color: #6e6e73;
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
}

.teo-email-sent {
    max-width: 640px;
    margin: 10px 0;
    padding: 14px 16px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: #f5f5f7;
    font-size: 13px;
    color: #1d1d1f;
}

.teo-email-sent-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.teo-email-sent span {
    color: #6e6e73;
    display: inline-block;
    min-width: 72px;
}
