.app-container .main-content.gpt-page {
    flex: 1;
    margin-left: calc(240px + var(--sidebar-layout-offset, 0px) - var(--sidebar-main-seam, 0px));
    padding: 0;
    background: #f7f7f8;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    transition: margin-left 0.3s ease;
}

.app-container.sidebar-collapsed .main-content.gpt-page {
    margin-left: calc(60px + var(--sidebar-layout-offset, 0px) - var(--sidebar-main-seam, 0px));
}

.gpt-shell {
    display: flex;
    height: 100vh;
    min-height: 0;
}

.gpt-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    border-right: 1px solid #e5e5ea;
}

.gpt-chat-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #e5e5ea;
    background: #fff;
    flex-shrink: 0;
}

.gpt-chat-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.gpt-chat-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10a37f, #1a7f64);
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
}

.gpt-chat-header h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gpt-chat-header p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #6e6e73;
}

.gpt-context-range {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.gpt-context-range-label {
    font-size: 12px;
    font-weight: 500;
    color: #6e6e73;
    white-space: nowrap;
}

.gpt-context-range-select,
.gpt-context-weeks-custom {
    border: 1px solid #d1d1d6;
    background: #fff;
    color: #1d1d1f;
    border-radius: 8px;
    font-size: 12px;
    font-family: inherit;
    padding: 6px 8px;
}

.gpt-context-range-select {
    min-width: 96px;
    cursor: pointer;
}

.gpt-context-weeks-custom {
    width: 56px;
    padding: 6px;
    text-align: center;
}

.gpt-context-range-select:focus,
.gpt-context-weeks-custom:focus {
    outline: none;
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}

.gpt-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.gpt-btn {
    border: 1px solid #d1d1d6;
    background: #fff;
    color: #1d1d1f;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gpt-btn:hover:not(:disabled) {
    background: #f5f5f7;
    border-color: #c7c7cc;
}

.gpt-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.gpt-btn-primary {
    background: #10a37f;
    border-color: #10a37f;
    color: #fff;
}

.gpt-btn-primary:hover:not(:disabled) {
    background: #0d8c6d;
    border-color: #0d8c6d;
}

.gpt-context-pill {
    font-size: 11px;
    color: #6e6e73;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gpt-context-pill:hover:not(:disabled) {
    background: #ececf0;
    border-color: #d1d1d6;
}

.gpt-context-pill:disabled {
    cursor: default;
    opacity: 0.7;
}

.gpt-context-pill.ready {
    color: #0d8c6d;
    background: #e8f8f3;
    border-color: #b8e8d8;
}

.gpt-context-pill.ready:hover:not(:disabled) {
    background: #d8f3ea;
    border-color: #9fdcc8;
}

.gpt-context-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gpt-context-modal[hidden] {
    display: none !important;
}

.gpt-context-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.gpt-context-modal-panel {
    position: relative;
    width: min(920px, 100%);
    max-height: min(88vh, 900px);
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e5e5ea;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gpt-context-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid #e5e5ea;
}

.gpt-context-modal-header h2 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
}

.gpt-context-modal-header p {
    margin: 0;
    font-size: 13px;
    color: #6e6e73;
}

.gpt-context-modal-close {
    border: none;
    background: #f5f5f7;
    color: #6e6e73;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.gpt-context-modal-close:hover {
    background: #ececf0;
    color: #1d1d1f;
}

.gpt-context-modal-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    background: #f9f9fb;
    border-bottom: 1px solid #e5e5ea;
}

.gpt-context-stat {
    font-size: 12px;
    color: #1d1d1f;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 999px;
    padding: 5px 10px;
}

.gpt-context-modal-body {
    flex: 1;
    margin: 0;
    padding: 16px 20px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.5;
    color: #1d1d1f;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #fff;
}

.gpt-context-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid #e5e5ea;
}

.gpt-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0 16px;
    scroll-behavior: smooth;
}

.gpt-messages-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 20px;
}

.gpt-welcome {
    text-align: center;
    padding: 32px 20px;
    max-width: 560px;
    margin: 0 auto;
}

.gpt-welcome h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
}

.gpt-welcome p {
    margin: 0 0 24px;
    font-size: 15px;
    color: #6e6e73;
    line-height: 1.5;
}

.gpt-suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.gpt-suggestion {
    border: 1px solid #e5e5ea;
    background: #fafafa;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: #1d1d1f;
    line-height: 1.4;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.gpt-suggestion:hover {
    background: #f0f0f2;
    border-color: #d1d1d6;
}

.gpt-message {
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.gpt-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.gpt-message.user .gpt-message-avatar {
    background: #5436da;
    color: #fff;
}

.gpt-message.assistant .gpt-message-avatar {
    background: #10a37f;
    color: #fff;
}

.gpt-message-body {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    line-height: 1.6;
    color: #1d1d1f;
    white-space: pre-wrap;
    word-break: break-word;
}

.gpt-message-body p {
    margin: 0 0 10px;
}

.gpt-message-body p:last-child {
    margin-bottom: 0;
}

.gpt-message-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    background: #f5f5f7;
    padding: 2px 5px;
    border-radius: 4px;
}

.gpt-message-body pre {
    background: #1d1d1f;
    color: #f5f5f7;
    padding: 12px 14px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
    margin: 8px 0;
}

.gpt-streaming-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.gpt-stream-cursor {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 2px;
    vertical-align: text-bottom;
    background: #10a37f;
    animation: gpt-cursor-blink 1s step-end infinite;
}

@keyframes gpt-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.gpt-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}

.gpt-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8e8e93;
    animation: gpt-bounce 1.2s infinite ease-in-out;
}

.gpt-typing span:nth-child(2) { animation-delay: 0.15s; }
.gpt-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes gpt-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-5px); opacity: 1; }
}

.gpt-composer-wrap {
    flex-shrink: 0;
    padding: 12px 20px 20px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 24%);
}

.gpt-composer {
    max-width: 780px;
    margin: 0 auto;
    border: 1px solid #d1d1d6;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
}

.gpt-composer:focus-within {
    border-color: #10a37f;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.12);
}

.gpt-composer textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.45;
    min-height: 24px;
    max-height: 180px;
    font-family: inherit;
    color: #1d1d1f;
    background: transparent;
    padding: 4px 2px;
}

.gpt-composer textarea::placeholder {
    color: #8e8e93;
}

.gpt-send-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: #10a37f;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.gpt-send-btn:hover:not(:disabled) {
    background: #0d8c6d;
}

.gpt-send-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gpt-history-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #f7f7f8;
    min-height: 0;
}

.gpt-history-header {
    padding: 14px 14px 10px;
    border-bottom: 1px solid #e5e5ea;
    flex-shrink: 0;
}

.gpt-history-header h2 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    color: #6e6e73;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gpt-new-chat-btn {
    width: 100%;
    justify-content: center;
}

.gpt-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.gpt-history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px;
    margin-bottom: 4px;
    position: relative;
}

.gpt-history-item-btn {
    flex: 1;
    border: none;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    min-width: 0;
}

.gpt-history-item-btn:hover {
    background: #ececf0;
}

.gpt-history-item.active .gpt-history-item-btn {
    background: #e8f8f3;
}

.gpt-history-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gpt-history-meta {
    display: block;
    font-size: 11px;
    color: #8e8e93;
    margin-top: 2px;
}

.gpt-history-delete {
    border: none;
    background: transparent;
    color: #8e8e93;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gpt-history-item:hover .gpt-history-delete {
    opacity: 1;
}

.gpt-history-delete:hover {
    background: #ffe8e8;
    color: #d70015;
}

.gpt-history-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: #8e8e93;
}

.gpt-mobile-history-toggle {
    display: none;
}

.gpt-status-bar {
    font-size: 12px;
    color: #8e8e93;
    text-align: center;
    padding: 0 20px 6px;
}

.gpt-status-bar.error {
    color: #d70015;
}

@media (max-width: 1024px) {
    .gpt-history-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        width: min(300px, 88vw);
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }

    .gpt-history-sidebar.open {
        transform: translateX(0);
    }

    .gpt-mobile-history-toggle {
        display: inline-flex;
    }

    .gpt-suggestions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container .main-content.gpt-page {
        margin-left: 0;
    }

    .gpt-chat-header {
        padding: 12px 14px;
    }

    .gpt-composer-wrap {
        padding: 10px 12px 16px;
    }
}

[data-theme="dark"] .gpt-page,
[data-theme="dark"] .gpt-chat-panel,
[data-theme="dark"] .gpt-chat-header,
[data-theme="dark"] .gpt-composer-wrap {
    background: #1c1c1e;
}

[data-theme="dark"] .main-content.gpt-page,
[data-theme="dark"] .gpt-history-sidebar {
    background: #121214;
}

[data-theme="dark"] .gpt-chat-panel,
[data-theme="dark"] .gpt-chat-header,
[data-theme="dark"] .gpt-history-header {
    border-color: #2c2c2e;
}

[data-theme="dark"] .gpt-chat-header h1,
[data-theme="dark"] .gpt-message-body,
[data-theme="dark"] .gpt-history-title,
[data-theme="dark"] .gpt-welcome h2,
[data-theme="dark"] .gpt-suggestion,
[data-theme="dark"] .gpt-btn {
    color: #f5f5f7;
}

[data-theme="dark"] .gpt-chat-header p,
[data-theme="dark"] .gpt-history-header h2,
[data-theme="dark"] .gpt-history-meta,
[data-theme="dark"] .gpt-welcome p,
[data-theme="dark"] .gpt-context-pill,
[data-theme="dark"] .gpt-status-bar {
    color: #aeaeb2;
}

[data-theme="dark"] .gpt-btn,
[data-theme="dark"] .gpt-composer,
[data-theme="dark"] .gpt-suggestion {
    background: #2c2c2e;
    border-color: #3a3a3c;
}

[data-theme="dark"] .gpt-composer textarea {
    color: #f5f5f7;
}

[data-theme="dark"] .gpt-history-item-btn:hover {
    background: #2c2c2e;
}

[data-theme="dark"] .gpt-history-item.active .gpt-history-item-btn {
    background: #1a3d34;
}

[data-theme="dark"] .gpt-message-body code {
    background: #2c2c2e;
}

[data-theme="dark"] .gpt-context-modal-panel,
[data-theme="dark"] .gpt-context-modal-body {
    background: #1c1c1e;
    color: #f5f5f7;
}

[data-theme="dark"] .gpt-context-modal-header,
[data-theme="dark"] .gpt-context-modal-stats,
[data-theme="dark"] .gpt-context-modal-footer {
    border-color: #2c2c2e;
}

[data-theme="dark"] .gpt-context-modal-stats {
    background: #121214;
}

[data-theme="dark"] .gpt-context-stat {
    background: #2c2c2e;
    border-color: #3a3a3c;
    color: #f5f5f7;
}

[data-theme="dark"] .gpt-context-modal-close {
    background: #2c2c2e;
    color: #aeaeb2;
}

[data-theme="dark"] .gpt-stream-cursor {
    background: #34d399;
}

[data-theme="dark"] .gpt-context-range-label {
    color: #aeaeb2;
}

[data-theme="dark"] .gpt-context-range-select,
[data-theme="dark"] .gpt-context-weeks-custom {
    color: #f5f5f7;
    background: #2c2c2e;
    border-color: #3a3a3c;
}

@media (max-width: 1024px) {
    .gpt-context-range-label {
        display: none;
    }
}

@media (max-width: 768px) {
    .gpt-chat-header-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .gpt-context-range {
        order: 3;
        width: 100%;
        justify-content: flex-end;
    }
}
