.tool-activity-panel {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(18, 24, 31, 0.42);
    padding: max(12px, env(safe-area-inset-top)) 0 0;
}

.tool-activity-panel[hidden] {
    display: none !important;
}

.tool-activity-panel,
.tool-activity-panel * {
    box-sizing: border-box;
}

.tool-activity-shell {
    display: flex;
    flex-direction: column;
    width: min(100%, 720px);
    height: min(92dvh, 920px);
    max-height: min(92dvh, 920px);
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    background: #f7f8fa;
    color: #1f2933;
    box-shadow: 0 -10px 36px rgba(24, 32, 44, 0.2);
    padding-bottom: env(safe-area-inset-bottom);
}

.tool-activity-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
    z-index: 2;
    padding: 12px 12px 10px;
    border-bottom: 1px solid #e7eaee;
    background: #fff;
}

.tool-activity-title-box {
    min-width: 0;
}

.tool-activity-header h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.35;
}

.tool-activity-header p {
    margin: 4px 0 0;
    color: #66717d;
    font-size: 11px;
    line-height: 1.4;
}

.tool-activity-header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.tool-activity-copy,
.tool-trace-settings-entry {
    min-height: 44px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tool-activity-header-button {
    min-height: 32px;
    border: 0;
    border-radius: 9px;
    padding: 5px 9px;
    background: #edf0f3;
    color: #34404c;
    font: inherit;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tool-activity-clear {
    color: #b33434;
    background: #fff0f0;
}

.tool-activity-filters {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    position: relative;
    z-index: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 12px 10px;
    border-bottom: 0;
    background: #fff;
    box-shadow: 0 1px 0 #e7eaee;
    scroll-padding-inline: 12px;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tool-activity-filters::after {
    content: '';
    flex: 0 0 4px;
}

.tool-activity-filters::-webkit-scrollbar {
    display: none;
}

.tool-activity-filter {
    flex: 0 0 auto;
    min-height: 34px;
    border: 0;
    border-radius: 10px;
    padding: 6px 12px;
    background: #eef1f4;
    color: #55616d;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tool-activity-filter[aria-pressed="true"] {
    background: #27384b;
    color: #fff;
}

.tool-activity-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
}

.tool-activity-entry {
    position: relative;
    max-width: 100%;
    margin-bottom: 8px;
    overflow: hidden;
    border: 1px solid #e4e8ec;
    border-left-width: 4px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(34, 47, 62, 0.05);
}

.tool-activity-entry:focus-visible {
    outline: 2px solid #4777a8;
    outline-offset: 2px;
}

.tool-activity-status-success { border-left-color: #3d9a63; }
.tool-activity-status-partial { border-left-color: #d99a29; }
.tool-activity-status-failed { border-left-color: #c74b4b; }
.tool-activity-status-legacy { border-left-color: #8b95a1; }

.tool-activity-summary {
    display: block;
    width: 100%;
    color: inherit;
    padding: 9px 11px 8px;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.tool-activity-summary-top,
.tool-activity-summary-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tool-activity-time,
.tool-activity-summary-footer {
    color: #77828d;
    font-size: 11px;
    line-height: 1.4;
}

.tool-activity-badge {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 3px 9px;
    background: #e9f4ed;
    color: #28764a;
    font-size: 11px;
    font-weight: 700;
}

.tool-activity-badge::before {
    content: '●';
    margin-right: 5px;
    font-size: 8px;
    vertical-align: 1px;
}

.tool-activity-status-partial .tool-activity-badge {
    background: #fff5df;
    color: #9a6513;
}

.tool-activity-status-failed .tool-activity-badge {
    background: #fff0f0;
    color: #a63131;
}

.tool-activity-status-legacy .tool-activity-badge {
    background: #edf0f3;
    color: #626e79;
}

.tool-activity-natural-summary {
    min-width: 0;
    max-width: 100%;
    margin: 6px 0;
    overflow-wrap: anywhere;
}

.tool-activity-natural-summary p {
    margin: 2px 0;
    font-size: 13px;
    line-height: 1.45;
}

.tool-activity-copy {
    width: 100%;
    margin: 12px 0 0;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid #d8dee5;
    background: #f7f9fb;
    color: #3f5061;
    font-size: 12px;
}

.tool-activity-details {
    border-top: 1px solid #e9ecef;
    padding: 10px 11px 12px;
    background: #fbfcfd;
}

.tool-activity-details[hidden] {
    display: none !important;
}

.tool-activity-details h3 {
    margin: 0 0 9px;
    font-size: 14px;
}

.tool-activity-call {
    margin-top: 8px;
    padding: 8px;
    border-radius: 12px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #e9edf1;
    overflow: hidden;
}

.tool-activity-field {
    display: grid;
    grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
    gap: 9px;
    padding: 3px 0;
    font-size: 12px;
    line-height: 1.45;
}

.tool-activity-field-label {
    color: #6b7681;
}

.tool-activity-field-value {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tool-activity-recall-items {
    margin: 9px 0 0;
    padding: 0;
    list-style: none;
}

.tool-activity-recall-items li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #eef1f4;
    overflow-wrap: anywhere;
}

.tool-activity-recall-items strong { font-size: 12px; }
.tool-activity-recall-items span { color: #75808b; font-size: 11px; line-height: 1.45; }
.tool-activity-legacy { color: #6f7983; font-size: 12px; }

.tool-activity-technical {
    margin-top: 12px;
    border-top: 1px solid #e4e8ec;
    padding-top: 10px;
}

.tool-activity-technical summary {
    min-height: 36px;
    line-height: 36px;
    color: #526170;
    font-size: 12px;
    cursor: pointer;
}

.tool-activity-legacy-group {
    margin-top: 12px;
    border-top: 1px solid #dfe4e9;
    padding-top: 8px;
}

.tool-activity-legacy-heading {
    display: flex;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 3px;
    color: #596673;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.tool-activity-legacy-hint {
    color: #87919b;
    font-size: 11px;
    font-weight: 400;
}

.tool-activity-legacy-list {
    padding-top: 6px;
}

.tool-activity-technical pre {
    max-width: 100%;
    max-height: 320px;
    overflow: auto;
    margin: 6px 0 0;
    padding: 10px;
    border-radius: 10px;
    background: #17202b;
    color: #edf3f8;
    font: 11px/1.5 Consolas, monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.tool-activity-empty {
    padding: 34px 16px;
    color: #75808b;
    text-align: center;
    font-size: 13px;
}

.tool-trace-settings-wrap {
    margin: 16px 14px calc(24px + env(safe-area-inset-bottom));
}

.tool-trace-settings-entry {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #e8e8e8;
    background: #fff;
    color: #333;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    font-size: 14px;
}

@media (min-width: 721px) {
    .tool-activity-panel { align-items: center; padding: 20px; }
    .tool-activity-shell { border-radius: 20px; }
}

@media (max-width: 390px) {
    .tool-activity-shell {
        height: min(94dvh, 844px);
        max-height: min(94dvh, 844px);
    }
    .tool-activity-header { padding-inline: 10px; }
    .tool-activity-header p { display: none; }
    .tool-activity-header-actions { gap: 4px; }
    .tool-activity-header-button { padding-inline: 8px; }
    .tool-activity-filters { padding-inline: 10px; scroll-padding-inline: 10px; }
    .tool-activity-list { padding-inline: 8px; }
    .tool-activity-field { grid-template-columns: 68px minmax(0, 1fr); }
}
