.research-plots-control {
    width: 300px;
    max-width: calc(100vw - 24px);
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #222;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
    font: 13px/1.35 "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

.research-plots-control.rp-collapsed {
    width: 34px;
    min-width: 34px;
    max-height: none;
    display: block;
    background: #fff;
}

.rp-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    text-decoration: none;
    color: inherit;
}

.rp-icon-btn .rp-swatch {
    width: 16px;
    height: 16px;
    border-width: 3px;
}

.rp-icon-btn.rp-has-plots .rp-swatch {
    box-shadow: 0 0 0 2px rgba(225, 29, 46, 0.25);
}

.rp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #f7f7f7;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
}

.rp-swatch {
    width: 14px;
    height: 14px;
    border: 3px solid #e11d2e;
    background: transparent;
    box-sizing: border-box;
    flex-shrink: 0;
}

.rp-title {
    font-weight: 600;
    flex: 1;
}

.rp-toggle {
    color: #666;
    font-size: 12px;
}

.research-plots-control,
.research-plots-control * {
    box-sizing: border-box;
}

.rp-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 10px;
}

.rp-footer {
    flex-shrink: 0;
    padding: 8px 10px;
    border-top: 1px solid #ddd;
    background: #f7f7f7;
}

.rp-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    min-width: 0;
}

.rp-btn {
    flex: 1;
    min-width: 0;
    appearance: none;
    border: 1px solid #ccc;
    background: #fafafa;
    border-radius: 3px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
}

.rp-btn-block {
    display: block;
    width: 100%;
    flex: none;
    margin-bottom: 8px;
}

.rp-clear {
    margin: 0;
}

.rp-btn:hover {
    background: #f0f0f0;
}

.rp-btn-primary {
    background: #e11d2e;
    border-color: #c41626;
    color: #fff;
    font-weight: 600;
}

.rp-btn-primary:hover {
    background: #c41626;
    color: #fff;
}

.rp-file {
    display: none;
}

.rp-meta {
    font-size: 11px;
    color: #666;
    margin-bottom: 10px;
    word-break: break-all;
}

.rp-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0;
    font-size: 12px;
}

.rp-range {
    width: 100%;
    max-width: 100%;
    display: block;
    margin: 0;
}

.rp-fields {
    border-top: 1px solid #eee;
    margin-top: 8px;
    padding-top: 8px;
}

.rp-fields h4 {
    margin: 0 0 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #777;
}

.rp-field {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    cursor: pointer;
}

.rp-field span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-hint {
    font-size: 11px;
    color: #777;
    margin: 0 0 8px;
}

.rp-persist {
    font-size: 11px;
    line-height: 1.35;
    color: #555;
    margin: 0 0 10px;
    padding: 6px 8px;
    background: #f6f6f6;
    border-radius: 3px;
}

.rp-persist.rp-task {
    background: #eef7ee;
    color: #1f6b2d;
}

.rp-persist.rp-saving,
.rp-persist.rp-loading {
    color: #666;
}

.rp-persist.rp-local {
    background: #f7f3ea;
    color: #6b531f;
}

.rp-empty {
    font-size: 12px;
    color: #888;
}

.plot-label {
    background: none !important;
    border: none !important;
}

.plot-label-inner {
    color: #fff;
    font: 500 11px/1.25 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-align: center;
    white-space: pre;
    text-shadow:
        0 0 4px #000,
        0 1px 2px #000,
        0 0 10px #000,
        1px 1px 0 #000,
        -1px -1px 0 #000;
    pointer-events: none;
}
