.v4-page {
    align-items: stretch;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 100vh;
}

.v4-dashboard {
    flex: 1;
    overflow-y: auto;
}

.v4-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.v4-session-page {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.v4-controls {
    border-top: 1px solid var(--border);
    flex: 0 0 auto;
    max-height: 25%;
    overflow-y: auto;
    padding: 16px;
}

.v4-control-section {
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    padding-bottom: 18px;
}

.v4-control-section:last-child {
    border-bottom: 0;
}

.v4-control-section h2 {
    font-size: 14px;
    margin-bottom: 12px;
}

.v4-control-section .btn {
    width: 100%;
}

.v4-inline-fields {
    display: grid;
    gap: 10px;
    grid-template-columns: 72px minmax(0, 1fr);
}

.v4-command-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.v4-help {
    color: var(--text-muted);
    font-size: 13px;
}

.v4-main-pane {
    background: var(--bg);
}

.v4-view-header {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    min-height: 56px;
    padding: 8px 18px;
}

.v4-view-header > span {
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v4-view-tabs {
    display: flex;
    gap: 6px;
}

.v4-view-tab {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
    padding: 8px 12px;
}

.v4-view-tab:hover {
    background: var(--surface-muted);
    border-color: var(--border);
}

.v4-view-tab.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
}

.v4-content-view {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.v4-content-view[hidden] {
    display: none;
}

.v4-conversation-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
    user-select: text;
}

.v4-conversation-messages * {
    user-select: text;
}

.v4-conversation-messages > :not(.v4-conversation-empty) {
    flex: 0 0 auto;
}

.v4-activity-messages {
    gap: 12px;
}

.msg-system-reminder {
    background: var(--surface-muted);
    border-style: dashed;
    box-shadow: none;
    margin-left: 20px;
    margin-right: 20px;
}

.msg-system-reminder .msg-origin {
    color: var(--brand);
}

.msg-text-system-reminder {
    color: var(--text-muted);
    white-space: pre-wrap;
}

.v4-conversation-empty {
    align-items: center;
    align-self: stretch;
    color: var(--text-muted);
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    min-height: 240px;
    text-align: center;
}

.v4-conversation-empty strong {
    color: var(--text);
    font-size: 16px;
}

.v4-composer-copy {
    display: grid;
    flex: 1;
    gap: 6px;
}

.v4-composer-status-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.v4-composer-status-row > span {
    color: var(--text-muted);
    font-size: 12px;
}

.v4-message-status[data-tone="pending"] {
    color: var(--brand);
}

.v4-message-status[data-tone="success"] {
    color: #15803d;
}

.v4-message-status[data-tone="error"] {
    color: var(--danger);
}

.v4-composer-copy textarea {
    width: 100%;
}

.v4-transcript-event {
    align-items: baseline;
    align-self: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 7px;
    max-width: min(720px, 92%);
    padding: 6px 12px;
}

.v4-transcript-event strong {
    color: var(--text);
}

.v4-transcript-event .msg-timestamp {
    margin-left: auto;
}

.v4-console-container {
    background: #0d1117;
}

.v4-console-header {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    min-height: 56px;
    padding: 10px 18px;
}

.v4-console-header > div {
    display: grid;
    gap: 2px;
}

.v4-console-header span {
    color: var(--text-muted);
    font-size: 12px;
}

.v4-console-output {
    background: #0d1117;
    color: #c9d1d9;
    flex: 1;
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    line-height: 1.55;
    margin: 0;
    overflow: auto;
    padding: 20px;
    white-space: pre-wrap;
}

.v4-console-line {
    display: inline;
}

.v4-console-command {
    color: #58a6ff;
}

.v4-console-stderr {
    color: #ff7b72;
}

.v4-console-transcript {
    color: #d2a8ff;
}

.v4-command-input {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    flex: 1;
    min-height: 42px;
    padding: 8px 12px;
}

.v4-offline-inspect {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 20px 24px;
}

.v4-offline-inspect h2 {
    font-size: 15px;
    margin-bottom: 12px;
}

.v4-inspect-grid {
    display: grid;
    font-size: 13px;
    gap: 8px 14px;
    grid-template-columns: max-content minmax(0, 1fr);
}

.v4-inspect-grid dt {
    color: var(--text-muted);
    font-weight: 700;
}

.v4-inspect-grid dd {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 820px) {
    .agent-workspace {
        height: auto;
        min-height: calc(100vh - 128px);
        overflow: visible;
    }

    .agent-workspace-body {
        display: flex;
        flex-direction: column;
        overflow: visible;
    }

    .agent-side-pane {
        border-bottom: 1px solid var(--border);
        border-right: 0;
        max-height: none;
    }

    .v4-controls {
        max-height: none;
        overflow: visible;
    }

    .v4-main-pane {
        min-height: 65vh;
    }

    .v4-view-header {
        align-items: flex-start;
        flex-direction: column;
    }
}
